package com.wbcs.config.resource;

import java.util.List;

import org.dom4j.Element;

import com.wbcs.config.xml.XmlAssistant;
import com.wbcs.exception.WbcsConfigLoadingException;

public class XmlElementRes extends AbsResource
{
    @Override
	public Object getValue(Element itemElement)
    {
        if(itemElement==null) return null;
        String key=itemElement.attributeValue("key");
        if(key==null||key.trim().equals(""))
        {
            throw new WbcsConfigLoadingException("配置的按钮资源项没有配置key属性");
        }
        List lstChildElements=itemElement.elements();
        if(lstChildElements==null||lstChildElements.size()==0) return null;
        return XmlAssistant.getInstance().parseXmlValueToXmlBean((Element)lstChildElements.get(0));
    }
}
